package com.lg.okframe.view;

import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.Canvas;
import android.graphics.Paint;
import android.support.annotation.Nullable;
import android.util.AttributeSet;
import android.view.Gravity;
import android.view.View;
import android.widget.FrameLayout;
import android.widget.LinearLayout;

import com.lg.okframe.R;

/**
 * Created by LG on 2018/8/15.
 */

public class menusing extends View {
    public menusing(Context context) {
        super(context);
    }

    public menusing(Context context, @Nullable AttributeSet attrs) {
        super(context, attrs);
    }

    public menusing(Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
        super(context, attrs, defStyleAttr);
    }


    @Override
    protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
        super.onMeasure(widthMeasureSpec, heightMeasureSpec);

        if(widthMeasureSpec>200){
            setMeasuredDimension(widthMeasureSpec,heightMeasureSpec);
        }else{
            setMeasuredDimension(200,300);
        }
    }

    @Override
    protected void onDraw(Canvas canvas) {
        super.onDraw(canvas);

        Paint paint = new Paint();
        Bitmap bitmap = BitmapFactory.decodeResource(getResources(), R.mipmap.sadc);
        canvas.drawBitmap(bitmap, 50, 50, paint);
        paint.setTextSize(40);
//      canvas.drawText("菜单1", 80,250,paint);
    }
}
